package com.wgworkshop.pems.model;

import com.wgworkshop.pems.checkgroup.CreateCheckGroup;
import com.wgworkshop.pems.checkgroup.PatchCheckGroup;
import com.wgworkshop.pems.checkgroup.UpdateCheckGroup;
import com.wgworkshop.pems.common.enums.GenderEnum;
import com.wgworkshop.pems.common.enums.StudentStatusEnum;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * 学生模型。
 * Created by wlc on 2017/7/2.
 */
public class StudentModel {
    @Null(message = "学生ID只能为null。",
            groups = {CreateCheckGroup.class, PatchCheckGroup.class})
    @NotNull(message = "学生ID不能为null。",
            groups = UpdateCheckGroup.class)
    @Min(value = 1,
            message = "不正确的学生ID[${validatedValue}]。",
            groups = UpdateCheckGroup.class)
    private Long id;

    @NotNull(message = "学号不能为null。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class})
    @Size(min = 1,
            max = 16,
            message = "学号长度应该介于{min}到{max}之间。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class, PatchCheckGroup.class})
    private String code;

    @NotNull(message = "姓名不能为null。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class})
    @Size(min = 1,
            max = 16,
            message = "姓名长度应该介于{min}到{max}之间。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class, PatchCheckGroup.class})
    private String name;

    @NotNull(message = "家长姓名不能为null。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class})
    @Size(min = 1,
            max = 16,
            message = "家长姓名长度应该介于{min}到{max}之间。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class, PatchCheckGroup.class})
    private String parent;

    @NotNull(message = "联系电话不能为null。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class})
    @Size(min = 1,
            max = 32,
            message = "联系电话长度应该介于{min}到{max}之间。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class, PatchCheckGroup.class})
    private String phone;

    @NotNull(message = "性别不能为null。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class})
    private GenderEnum gender;

    @NotNull(message = "出生日期不能为null。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class})
    private Date birthday;

    @NotNull(message = "入学日期不能为null。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class})
    private Date startDate;

    @NotNull(message = "状态不能为null。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class})
    private StudentStatusEnum status;

    @Size(max = 512,
            message = "备注长度应该不大于{max}。",
            groups = {CreateCheckGroup.class, UpdateCheckGroup.class, PatchCheckGroup.class})
    private String comment;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getParent() {
        return parent;
    }

    public void setParent(String parent) {
        this.parent = parent;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public GenderEnum getGender() {
        return gender;
    }

    public void setGender(GenderEnum gender) {
        this.gender = gender;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public StudentStatusEnum getStatus() {
        return status;
    }

    public void setStatus(StudentStatusEnum status) {
        this.status = status;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }
}
